#ifndef NERTHREAD_H
#define NERTHREAD_H

#include <QThread>
#include <QMap>

class NERThread : public QThread
{
    Q_OBJECT
private:
    std::string m_input;

    bool m_isRunning;

    bool m_isCancel = false;
    int m_nerId = 0;

    QMap<QString, QStringList> m_nerResult;
    bool checkCanceled();
    QString loadCacheIfPossible();
    void saveNerCache(QString &key);
    void bertText();
    void nerTask();
public:
    ~NERThread();
    NERThread();
    void setCancel();
    void setInputText(std::string text);

    QMap<QString, QStringList> &nerResult();
signals:
    void returnNerResult(int);
protected:
    void run();
};

#endif // OCRTHREAD_H
